package homework2;

public class Test03 {
    public static void main(String[] args) {
        testString("abcd");
        StringBuilder stringBuilder = new StringBuilder("abcd");
        testStringBuilder(stringBuilder);
    }
    public static void testString(String string){
        long start=System.currentTimeMillis();
        for (int i = 1; i <=10000; i++) {
            System.out.print("1111"+string);
        }
        long end=System.currentTimeMillis();
        System.out.println("程序耗时:"+(end-start)+"毫秒");
    }
    public static void testStringBuilder(StringBuilder string){
        long start1=System.currentTimeMillis();
        for (int i = 1; i <=10000; i++) {
            System.out.print("1111"+string);
        }
        long end1=System.currentTimeMillis();
        System.out.println("程序耗时:"+(end1-start1)+"毫秒");
    }
}
